<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
</head>
<body>
<ol class="am-pagination" th:fragment="pageNav(pageInfo, prevText, nextText, prefix)">
    <th:block th:if="${pageInfo.hasPreviousPage}">
        <li class="am-pagination-prev"><a th:href="@{'/'+${prefix}+'/'+${pageInfo.prePage}}" th:text="${prevText}"></a></li>
    </th:block>
    <th:block th:each="navIndex :${ pageInfo.navigatepageNums}">
        <th:block th:if="${pageInfo.pages} <= 5">
            <li th:class="${pageInfo.pageNum}==${navIndex}?'current':''">
                <a th:href="@{'/page/'+${navIndex}}" th:text="${navIndex}"></a>
            </li>
        </th:block>
        <th:block th:if="${pageInfo.pages} > 5">
            <li th:if="${pageInfo.pageNum <=3 &&  navIndex <= 5}" th:class="${pageInfo.pageNum}==${navIndex}?'current':''">
                <a th:href="@{'/page/'+${navIndex}}" th:text="${navIndex}"></a>
            </li>
            <li th:if="${pageInfo.pageNum >= pageInfo.pages-2 &&  navIndex > pageInfo.pages-5}" th:class="${pageInfo.pageNum}==${navIndex}?'current':''">
                <a th:href="@{'/page/'+${navIndex}}" th:text="${navIndex}"></a>
            </li>
            <li th:if="${pageInfo.pageNum >=4 && pageInfo.pageNum <= pageInfo.pages-3 &&  navIndex >= pageInfo.pageNum-2 && navIndex <= pageInfo.pageNum+2}"  th:class="${pageInfo.pageNum}==${navIndex}?'current':''">
                <a th:href="@{'/page/'+${navIndex}}" th:text="${navIndex}"></a>
            </li>
        </th:block>



    </th:block>
    <th:block th:if="${pageInfo.hasNextPage}">
        <li class="am-pagination-next"><a th:href="@{'/'+${prefix}+'/'+${pageInfo.nextPage}}" th:text="${nextText}"></a></li>
    </th:block>
</ol>

<div th:fragment="pageAdminNav(pageInfo)">
    <div class="clearfix" align="center">
        <ul class="pagination m-b-5 pull-right">
            <li th:if="${pageInfo.hasPreviousPage}">
                <a th:href="@{'?page='+${pageInfo.prePage}}" aria-label="Previous">
                    <i class="fa fa-angle-left"></i>&nbsp;上一页
                </a>
            </li>
            <th:block th:each="nav : ${pageInfo.navigatepageNums}">
                <li th:class="${nav==pageInfo.pageNum}?'active':''"><a th:href="@{'?page='+${nav}}" th:text="${nav}"></a>
                </li>
            </th:block>

            <th:block th:if="${pageInfo.hasNextPage}">
                <li>
                    <a th:href="@{'?page='+${pageInfo.nextPage}}" aria-label="Next">
                        下一页&nbsp;<i class="fa fa-angle-right"></i>
                    </a>
                </li>
            </th:block>

            <li><span th:text="'共'+${pageInfo.pages}+'页'"></span></li>
        </ul>
    </div>
    <!--分页块-->
   <!-- <tfoot>
    <tr>
        <td colspan="9" align="center">
            <a th:if="${ not pageInfo.isFirstPage}" th:href="|${#request.contextPath}/emp/getPaged?pageNum=1&pageSize=${pageInfo.pageSize}|">第一页</a>
            <a th:if="${ not pageInfo.isFirstPage}" th:href="|${#request.contextPath}/emp/getPaged?pageNum=${pageInfo.pageNum-1}&pageSize=${pageInfo.pageSize}|">上一页</a>
            <a href="#"
               th:each="pageNum : ${#numbers.sequence(1,pageInfo.pages)}"
               th:text="|[${pageNum}]|"
               th:href="|${#request.contextPath}/emp/getPaged?pageNum=${pageNum}&pageSize=${pageInfo.pageSize}|"
            ></a>
            <a th:if="${ not pageInfo.isLastPage}" th:href="|${#request.contextPath}/emp/getPaged?pageNum=${pageInfo.pageNum+1}&pageSize=${pageInfo.pageSize}|">下一页</a>
            <a th:if="${ not pageInfo.isLastPage}" th:href="|${#request.contextPath}/emp/getPaged?pageNum=${pageInfo.pages}&pageSize=${pageInfo.pageSize}|">末页</a>
            到：<input type="text" size="1" id="pageNum" onkeydown="goPage()"> <input type="button" value="go" onclick="jumpToPage()">
            <select onchange="changePageSize(this.value)">
                <option value="3" th:selected="${pageInfo.pageSize==3}?true:false">3</option>
                <option value="5" th:selected="${pageInfo.pageSize==5}?true:false">5</option>
                <option value="8" th:selected="${pageInfo.pageSize==8}?true:false">8</option>
            </select>
            总计: <span th:text="${pageInfo.total}"></span> 行
        </td>
    </tr>
    </tfoot>-->
</div>

</body>
</html>